package com.ysucode.dao.battle;

import com.ysucode.domain.PkUser;
import org.apache.ibatis.annotations.*;

@Mapper
public interface PkUserMapper {

    @Insert("insert into pk_user values(#{id},#{rankscore},#{matchsum},#{matchvictory})")
    Integer addUserPk(PkUser pkUser);

    @Select("select * from tb_user_pk where id =#{id}")
    PkUser selectOneById(@Param("id") int id);

    //update 表名 set 列名1=值1,列名2=值2,…[where 条件]; #修改表数据 如果没有where条件 则表中数据全部修改
    @Update("update tb_user_pk set rankscore=rankscore+#{score}," +
            "matchsum=matchsum+1,matchvictory=matchvictory+#{victory} where id=#{id}")
    Integer updateOneById(@Param("score") int score, @Param("victory") int victory, @Param("id") int id);

}
